
using System.Collections.Generic;
using UnityEngine;
/*
	Xlsx表Select脚本【行列式】
*/
public static partial class HFDbHelper
{
	/// <summary>
	/// Table_GameLanguage表数据
	/// Key:语言包enLanguageClassify
	/// Value:表数据
	/// </summary>
	static Dictionary<int,Table_GameLanguage> mTable_GameLanguage_Maping = new Dictionary<int,Table_GameLanguage>();
	/// <summary>
    /// 读取Table_GameLanguage表数据
    /// </summary>
    static void OnRead_Table_GameLanguage()
    {        
        mTable_GameLanguage_Maping.Clear();
	if (mXlsxDbLibrary.masters != null)
        {            
            for (int mi = 0; mi < mXlsxDbLibrary.masters.Length; mi++)
            {
	OnRead_Lang_Table_GameLanguage(mi);
            }
        }
    }
	/// <summary>
    /// 读取Table_GameLanguage表数据
    /// </summary>
	/// <param name="_lang">语言类别</param>
	/// <returns>缓存数据</returns>
	static Table_GameLanguage OnRead_Lang_Table_GameLanguage(int _lang)
    {
        Table_GameLanguage cache = null;
///#if UNITY_EDITOR
///        System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
///        watch.Start();
///#endif
        if (!mTable_GameLanguage_Maping.TryGetValue(_lang, out cache))
        {
	XlsxDbTable table = mXlsxDbLibrary.masters[_lang].tables[0];
	if (table.rows != null && table.rows.Length > 0)
	{
	cache = new Table_GameLanguage(table.rows[0]);	
	mTable_GameLanguage_Maping[_lang] = cache;
	}                    
        }
///#if UNITY_EDITOR
///        watch.Stop();
///        //Log.Error($"OnRead_Lang_Table_GameLanguage({_lang}_{(enLanguageClassify)_lang})=>[{watch.ElapsedMilliseconds}]{watch.Elapsed.ToString()}");
///#endif
	return cache;
    }
    /// <summary>
    /// 查询数据
    /// </summary>
    /// <returns>数据集</returns>
    public static Table_GameLanguage Select_Table_GameLanguage()
    {
	Table_GameLanguage cache = null;
        if (!mTable_GameLanguage_Maping.TryGetValue(HFLanguageHelper.langIndex, out cache))
        {
            cache = OnRead_Lang_Table_GameLanguage(HFLanguageHelper.langIndex);
        }
        return cache;        
    }
}